﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Tags.aspx.vb" Inherits="helzwebscripting.Tags" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1 class="bigHeadings">Find Twilight Scenes</h1>
    <p>
    Click on a tag to find related scenes!


        <br />
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
            DataSourceID="tagList" GroupItemCount="3">
            <AlternatingItemTemplate>
                <td runat="server" style="">
                     <asp:HyperLink ID="Tag" runat="server" NavigateUrl='<%# Eval("Tag","~/Tags.aspx?Tag={0}") %>' Text='<%# Eval("Tag") %>'> </asp:HyperLink>
                </td>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <td runat="server" style="">
                    ID:
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                    <br />Tag:
                    <asp:TextBox ID="TagTextBox" runat="server" Text='<%# Bind("Tag") %>' />
                    <br />
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                    <br />
                </td>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <EmptyItemTemplate>
<td runat="server" />
            </EmptyItemTemplate>
            <GroupTemplate>
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
            <InsertItemTemplate>
                <td runat="server" style="">
                    Tag:
                    <asp:TextBox ID="TagTextBox" runat="server" Text='<%# Bind("Tag") %>' />
                    <br />
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                    <br />
                </td>
            </InsertItemTemplate>
            <ItemTemplate>
                <td runat="server" style="">
                  <asp:HyperLink ID="Tag" runat="server" NavigateUrl='<%# Eval("Tag","~/Tags.aspx?Tag={0}") %>' Text='<%# Eval("Tag") %>'> </asp:HyperLink>
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                <tr ID="groupPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <td runat="server" style="">
                   <asp:HyperLink ID="Tag" runat="server" NavigateUrl='<%# Eval("Tag","~/Tags.aspx?Tag={0}") %>' Text='<%# Eval("Tag") %>'> </asp:HyperLink>
                </td>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="tagList" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
            ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
            SelectCommand="SELECT [ID], [Tag] FROM [Tags]"></asp:SqlDataSource>


        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="ScenesFromTag" CssClass="commentsGV">
            <Columns>
                 <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="SceneDetails.aspx?ID={0}" DataTextField="SceneName" 
                HeaderText="Scene" Text="SceneName" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="ScenesFromTag" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
            ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
            SelectCommand="SELECT DISTINCT [SceneName], [Tag], [ID] FROM [SceneTagView] WHERE ([Tag] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Tag" QueryStringField="Tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>


        <br />
        <br />
        <br />


        <br />
        <br />
        <br />
    </p>
</asp:Content>
